<template>
	<view class="swiper_all" :style="{display: swiperState ? 'unset' : 'none'}">
		<u-swiper @click="handleChange" :list="swiperList" indicator indicatorMode="line" :height="'100%'" circular
			style="background-color: transparent;"></u-swiper>
	</view>
</template>

<script setup lang="ts">
import { onMounted, onUnmounted, ref } from 'vue';
import { getAllArticlesBytnId } from '@/api/article.js';
import { useFullSwiper } from '../../store/Pinia/fullSwiper';
import { storeToRefs } from 'pinia';
	
	const fullSwiper = useFullSwiper()
	const { swiperState } = storeToRefs(fullSwiper)
	const swiperList = ref([])
	// const swiperState = ref(false)
	const timer = ref(null)
	const time = 1000 * 60 * 10
	const getSwiperList = () => {
		getAllArticlesBytnId({
			tenantId: uni.getStorageSync('tenantId') || 0,
			artModule: "lbt"
			// artClassId: "1"
		}).then((res) => {
			console.log(res.data.data)
			swiperList.value = res.data.data.records[0].artInfoImageList || [];
			console.log('1111',swiperList.value)
	
		})
	
	}
	const handleChange = () => fullSwiper.setFull(false)
	const resetTime = () => {
		if (timer.value) {
			clearTimeout(timer.value)
			fullSwiper.setFull(false)
		}
		timer.value = setTimeout(() => {
			fullSwiper.setFull(true)
		}, time)
	}
	onMounted(() => {
		getSwiperList()
		resetTime()
	})
	onUnmounted(() => {
		clearTimeout(timer.value)
		timer.value = null
		fullSwiper.setFull(false)
	})
	defineExpose({
		resetTime,
	})
</script>

<style scoped>
.swiper_all {
	height: 100vh;
	width: 100%;
	position: absolute;
	z-index: 999999;
}
</style>